{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发票编号</th>\n",
       "      <th>分店</th>\n",
       "      <th>城市</th>\n",
       "      <th>顾客类型</th>\n",
       "      <th>性别</th>\n",
       "      <th>商品类别</th>\n",
       "      <th>商品单价（美元）</th>\n",
       "      <th>购买数量（件）</th>\n",
       "      <th>购买日期</th>\n",
       "      <th>时间</th>\n",
       "      <th>支付方式</th>\n",
       "      <th>支付费用（美元）</th>\n",
       "      <th>收益（美元）</th>\n",
       "      <th>购物体验评分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>426-39-2418</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>61.41</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-14</td>\n",
       "      <td>10:02:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>429.87</td>\n",
       "      <td>21.4935</td>\n",
       "      <td>9.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>527-09-6272</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>28.45</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-21</td>\n",
       "      <td>10:17:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>142.25</td>\n",
       "      <td>7.1125</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>761-49-0439</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>12.10</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-01-19</td>\n",
       "      <td>10:17:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>96.80</td>\n",
       "      <td>4.8400</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>421-95-9805</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>28.96</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-07</td>\n",
       "      <td>10:18:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>28.96</td>\n",
       "      <td>1.4480</td>\n",
       "      <td>6.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>811-03-8790</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>45.48</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-01</td>\n",
       "      <td>10:22:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>454.80</td>\n",
       "      <td>22.7400</td>\n",
       "      <td>4.8</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          发票编号   分店   城市  顾客类型 性别  商品类别  商品单价（美元）  购买数量（件）       购买日期  \\\n",
       "0  426-39-2418  分店C  城市C  普通顾客  男  电子配件     61.41        7 2020-01-14   \n",
       "1  527-09-6272  分店A  城市A    会员  女  电子配件     28.45        5 2020-03-21   \n",
       "2  761-49-0439  分店B  城市B    会员  女  电子配件     12.10        8 2020-01-19   \n",
       "3  421-95-9805  分店A  城市A  普通顾客  女  电子配件     28.96        1 2020-02-07   \n",
       "4  811-03-8790  分店A  城市A  普通顾客  女  电子配件     45.48       10 2020-03-01   \n",
       "\n",
       "         时间  支付方式  支付费用（美元）   收益（美元）  购物体验评分  \n",
       "0  10:02:00    现金    429.87  21.4935     9.8  \n",
       "1  10:17:00   信用卡    142.25   7.1125     9.1  \n",
       "2  10:17:00  电子钱包     96.80   4.8400     8.6  \n",
       "3  10:18:00   信用卡     28.96   1.4480     6.2  \n",
       "4  10:22:00   信用卡    454.80  22.7400     4.8  "
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_sale[0:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>发票编号</th>\n",
       "      <th>分店</th>\n",
       "      <th>城市</th>\n",
       "      <th>顾客类型</th>\n",
       "      <th>性别</th>\n",
       "      <th>商品类别</th>\n",
       "      <th>商品单价（美元）</th>\n",
       "      <th>购买数量（件）</th>\n",
       "      <th>购买日期</th>\n",
       "      <th>时间</th>\n",
       "      <th>支付方式</th>\n",
       "      <th>支付费用（美元）</th>\n",
       "      <th>收益（美元）</th>\n",
       "      <th>购物体验评分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>426-39-2418</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>61.41</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-14</td>\n",
       "      <td>10:02:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>429.87</td>\n",
       "      <td>21.4935</td>\n",
       "      <td>9.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>527-09-6272</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>28.45</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-21</td>\n",
       "      <td>10:17:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>142.25</td>\n",
       "      <td>7.1125</td>\n",
       "      <td>9.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>761-49-0439</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>12.10</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-01-19</td>\n",
       "      <td>10:17:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>96.80</td>\n",
       "      <td>4.8400</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>421-95-9805</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>28.96</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-07</td>\n",
       "      <td>10:18:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>28.96</td>\n",
       "      <td>1.4480</td>\n",
       "      <td>6.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>811-03-8790</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>45.48</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-01</td>\n",
       "      <td>10:22:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>454.80</td>\n",
       "      <td>22.7400</td>\n",
       "      <td>4.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>745-71-3520</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>25.22</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-04</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>176.54</td>\n",
       "      <td>8.8270</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>250-81-7186</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>99.69</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-27</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>99.69</td>\n",
       "      <td>4.9845</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>399-69-4630</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>22.21</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-07</td>\n",
       "      <td>10:23:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>133.26</td>\n",
       "      <td>6.6630</td>\n",
       "      <td>8.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>365-64-0515</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>46.95</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-12</td>\n",
       "      <td>10:25:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>234.75</td>\n",
       "      <td>11.7375</td>\n",
       "      <td>7.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>213-32-1216</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>66.06</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-23</td>\n",
       "      <td>10:28:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>396.36</td>\n",
       "      <td>19.8180</td>\n",
       "      <td>7.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>226-31-3081</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>15.28</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-08</td>\n",
       "      <td>10:29:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>76.40</td>\n",
       "      <td>3.8200</td>\n",
       "      <td>9.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>734-91-1155</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>45.71</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-26</td>\n",
       "      <td>10:34:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>137.13</td>\n",
       "      <td>6.8565</td>\n",
       "      <td>7.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>438-23-1242</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>75.88</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>10:38:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>531.16</td>\n",
       "      <td>16.5580</td>\n",
       "      <td>8.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>512-98-1403</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>26.48</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-21</td>\n",
       "      <td>10:40:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>79.44</td>\n",
       "      <td>3.9720</td>\n",
       "      <td>4.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>366-93-0948</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>66.35</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-01-31</td>\n",
       "      <td>10:46:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>66.35</td>\n",
       "      <td>3.3175</td>\n",
       "      <td>9.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>466-61-5506</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>90.70</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-02-26</td>\n",
       "      <td>10:52:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>544.20</td>\n",
       "      <td>27.2100</td>\n",
       "      <td>5.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>778-34-2523</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>48.62</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>10:57:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>388.96</td>\n",
       "      <td>19.4480</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>226-34-0034</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>13.78</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-01-10</td>\n",
       "      <td>11:10:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>55.12</td>\n",
       "      <td>2.7560</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>831-81-6575</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>75.59</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-23</td>\n",
       "      <td>11:12:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>680.31</td>\n",
       "      <td>14.0155</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>636-48-8204</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>34.56</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>11:15:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>172.80</td>\n",
       "      <td>8.6400</td>\n",
       "      <td>9.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>233-34-0817</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>98.84</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-15</td>\n",
       "      <td>11:21:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>98.84</td>\n",
       "      <td>4.9420</td>\n",
       "      <td>8.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>300-71-4605</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>86.04</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-02-25</td>\n",
       "      <td>11:24:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>430.20</td>\n",
       "      <td>21.5100</td>\n",
       "      <td>4.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>575-67-1508</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>38.60</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-01-29</td>\n",
       "      <td>11:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>38.60</td>\n",
       "      <td>1.9300</td>\n",
       "      <td>6.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>551-21-3069</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>23.07</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-01</td>\n",
       "      <td>11:27:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>207.63</td>\n",
       "      <td>10.3815</td>\n",
       "      <td>4.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>831-07-6050</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>32.71</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-19</td>\n",
       "      <td>11:30:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>163.55</td>\n",
       "      <td>8.1775</td>\n",
       "      <td>9.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>804-38-3935</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>93.78</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-01-30</td>\n",
       "      <td>11:32:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>281.34</td>\n",
       "      <td>14.0670</td>\n",
       "      <td>5.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>886-77-9084</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>71.89</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-02-19</td>\n",
       "      <td>11:33:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>575.12</td>\n",
       "      <td>18.7560</td>\n",
       "      <td>5.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>603-07-0961</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>74.79</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-01-10</td>\n",
       "      <td>11:34:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>373.95</td>\n",
       "      <td>18.6975</td>\n",
       "      <td>4.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>652-49-6720</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>60.95</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-18</td>\n",
       "      <td>11:40:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>60.95</td>\n",
       "      <td>3.0475</td>\n",
       "      <td>5.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>189-40-5216</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>电子配件</td>\n",
       "      <td>96.37</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-01-09</td>\n",
       "      <td>11:40:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>674.59</td>\n",
       "      <td>23.7295</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>970</th>\n",
       "      <td>743-88-1662</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>95.49</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-22</td>\n",
       "      <td>18:17:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>668.43</td>\n",
       "      <td>33.4215</td>\n",
       "      <td>8.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>971</th>\n",
       "      <td>560-30-5617</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>24.77</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-24</td>\n",
       "      <td>18:27:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>123.85</td>\n",
       "      <td>6.1925</td>\n",
       "      <td>8.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>972</th>\n",
       "      <td>554-53-3790</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>37.02</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>18:33:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>222.12</td>\n",
       "      <td>11.1060</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>973</th>\n",
       "      <td>695-51-0018</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>34.84</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-02-10</td>\n",
       "      <td>18:36:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>139.36</td>\n",
       "      <td>6.9680</td>\n",
       "      <td>7.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>974</th>\n",
       "      <td>618-34-8551</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>93.18</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-01-16</td>\n",
       "      <td>18:41:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>186.36</td>\n",
       "      <td>9.3180</td>\n",
       "      <td>8.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>975</th>\n",
       "      <td>696-90-2548</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>25.84</td>\n",
       "      <td>3</td>\n",
       "      <td>2020-03-10</td>\n",
       "      <td>18:55:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>77.52</td>\n",
       "      <td>3.8760</td>\n",
       "      <td>6.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>976</th>\n",
       "      <td>751-69-0068</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>99.24</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-03-19</td>\n",
       "      <td>19:09:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>893.16</td>\n",
       "      <td>44.6580</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>977</th>\n",
       "      <td>123-35-4896</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>46.66</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>19:11:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>419.94</td>\n",
       "      <td>20.9970</td>\n",
       "      <td>5.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>978</th>\n",
       "      <td>129-29-8530</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>62.62</td>\n",
       "      <td>5</td>\n",
       "      <td>2020-03-10</td>\n",
       "      <td>19:15:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>313.10</td>\n",
       "      <td>15.6550</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>979</th>\n",
       "      <td>423-57-2993</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>93.39</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-27</td>\n",
       "      <td>19:18:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>560.34</td>\n",
       "      <td>28.0170</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>980</th>\n",
       "      <td>510-79-0415</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>23.08</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-24</td>\n",
       "      <td>19:20:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>138.48</td>\n",
       "      <td>6.9240</td>\n",
       "      <td>4.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>981</th>\n",
       "      <td>154-74-7179</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>54.45</td>\n",
       "      <td>1</td>\n",
       "      <td>2020-02-26</td>\n",
       "      <td>19:24:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>54.45</td>\n",
       "      <td>2.7225</td>\n",
       "      <td>7.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>982</th>\n",
       "      <td>575-30-8091</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>72.50</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-03-16</td>\n",
       "      <td>19:25:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>580.00</td>\n",
       "      <td>29.0000</td>\n",
       "      <td>9.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>983</th>\n",
       "      <td>825-94-5922</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>25.31</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-03-02</td>\n",
       "      <td>19:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>50.62</td>\n",
       "      <td>2.5310</td>\n",
       "      <td>7.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>984</th>\n",
       "      <td>752-23-3760</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>64.08</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-19</td>\n",
       "      <td>19:29:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>448.56</td>\n",
       "      <td>22.4280</td>\n",
       "      <td>7.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>985</th>\n",
       "      <td>394-30-3170</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>88.43</td>\n",
       "      <td>8</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>19:35:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>707.44</td>\n",
       "      <td>35.3720</td>\n",
       "      <td>4.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>986</th>\n",
       "      <td>827-77-7633</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>98.09</td>\n",
       "      <td>9</td>\n",
       "      <td>2020-02-17</td>\n",
       "      <td>19:41:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>882.81</td>\n",
       "      <td>144.1405</td>\n",
       "      <td>9.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>987</th>\n",
       "      <td>423-80-0988</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>76.40</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-01-30</td>\n",
       "      <td>19:42:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>152.80</td>\n",
       "      <td>7.6400</td>\n",
       "      <td>6.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>988</th>\n",
       "      <td>883-17-4236</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>14.39</td>\n",
       "      <td>2</td>\n",
       "      <td>2020-03-02</td>\n",
       "      <td>19:44:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>28.78</td>\n",
       "      <td>1.4390</td>\n",
       "      <td>7.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>989</th>\n",
       "      <td>493-65-6248</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>36.98</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-01-01</td>\n",
       "      <td>19:48:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>369.80</td>\n",
       "      <td>18.4900</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>990</th>\n",
       "      <td>503-07-0930</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>58.39</td>\n",
       "      <td>7</td>\n",
       "      <td>2020-02-23</td>\n",
       "      <td>19:49:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>408.73</td>\n",
       "      <td>20.4365</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>991</th>\n",
       "      <td>327-40-9673</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>72.60</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-13</td>\n",
       "      <td>19:51:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>435.60</td>\n",
       "      <td>21.7800</td>\n",
       "      <td>6.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>992</th>\n",
       "      <td>880-46-5796</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>76.92</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-17</td>\n",
       "      <td>19:53:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>769.20</td>\n",
       "      <td>38.4600</td>\n",
       "      <td>5.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>993</th>\n",
       "      <td>276-54-0879</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>97.74</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-03-12</td>\n",
       "      <td>19:53:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>390.96</td>\n",
       "      <td>119.5480</td>\n",
       "      <td>6.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>225-32-0908</td>\n",
       "      <td>分店C</td>\n",
       "      <td>城市C</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.86</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-01-26</td>\n",
       "      <td>19:54:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>448.60</td>\n",
       "      <td>22.4300</td>\n",
       "      <td>8.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>828-61-5674</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.02</td>\n",
       "      <td>10</td>\n",
       "      <td>2020-03-20</td>\n",
       "      <td>19:57:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>440.20</td>\n",
       "      <td>122.0100</td>\n",
       "      <td>9.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>670-71-7306</td>\n",
       "      <td>分店B</td>\n",
       "      <td>城市B</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>44.63</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-01-02</td>\n",
       "      <td>20:08:00</td>\n",
       "      <td>信用卡</td>\n",
       "      <td>267.78</td>\n",
       "      <td>13.3890</td>\n",
       "      <td>5.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>630-74-5166</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>普通顾客</td>\n",
       "      <td>男</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>62.13</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-22</td>\n",
       "      <td>20:19:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>372.78</td>\n",
       "      <td>18.6390</td>\n",
       "      <td>7.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>182-52-7000</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>27.04</td>\n",
       "      <td>4</td>\n",
       "      <td>2020-01-01</td>\n",
       "      <td>20:26:00</td>\n",
       "      <td>电子钱包</td>\n",
       "      <td>108.16</td>\n",
       "      <td>5.4080</td>\n",
       "      <td>6.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>802-70-5316</td>\n",
       "      <td>分店A</td>\n",
       "      <td>城市A</td>\n",
       "      <td>会员</td>\n",
       "      <td>女</td>\n",
       "      <td>运动与旅行</td>\n",
       "      <td>92.13</td>\n",
       "      <td>6</td>\n",
       "      <td>2020-03-06</td>\n",
       "      <td>20:34:00</td>\n",
       "      <td>现金</td>\n",
       "      <td>552.78</td>\n",
       "      <td>127.6390</td>\n",
       "      <td>8.3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            发票编号   分店   城市  顾客类型 性别   商品类别  商品单价（美元）  购买数量（件）       购买日期  \\\n",
       "0    426-39-2418  分店C  城市C  普通顾客  男   电子配件     61.41        7 2020-01-14   \n",
       "1    527-09-6272  分店A  城市A    会员  女   电子配件     28.45        5 2020-03-21   \n",
       "2    761-49-0439  分店B  城市B    会员  女   电子配件     12.10        8 2020-01-19   \n",
       "3    421-95-9805  分店A  城市A  普通顾客  女   电子配件     28.96        1 2020-02-07   \n",
       "4    811-03-8790  分店A  城市A  普通顾客  女   电子配件     45.48       10 2020-03-01   \n",
       "5    745-71-3520  分店A  城市A    会员  女   电子配件     25.22        7 2020-02-04   \n",
       "6    250-81-7186  分店C  城市C  普通顾客  女   电子配件     99.69        1 2020-02-27   \n",
       "7    399-69-4630  分店C  城市C  普通顾客  男   电子配件     22.21        6 2020-03-07   \n",
       "8    365-64-0515  分店A  城市A  普通顾客  女   电子配件     46.95        5 2020-02-12   \n",
       "9    213-32-1216  分店A  城市A  普通顾客  女   电子配件     66.06        6 2020-01-23   \n",
       "10   226-31-3081  分店C  城市C  普通顾客  女   电子配件     15.28        5 2020-03-08   \n",
       "11   734-91-1155  分店B  城市B  普通顾客  女   电子配件     45.71        3 2020-03-26   \n",
       "12   438-23-1242  分店B  城市B  普通顾客  男   电子配件     75.88        7 2020-01-24   \n",
       "13   512-98-1403  分店A  城市A    会员  女   电子配件     26.48        3 2020-03-21   \n",
       "14   366-93-0948  分店A  城市A    会员  男   电子配件     66.35        1 2020-01-31   \n",
       "15   466-61-5506  分店B  城市B    会员  女   电子配件     90.70        6 2020-02-26   \n",
       "16   778-34-2523  分店A  城市A    会员  女   电子配件     48.62        8 2020-01-24   \n",
       "17   226-34-0034  分店B  城市B  普通顾客  女   电子配件     13.78        4 2020-01-10   \n",
       "18   831-81-6575  分店B  城市B    会员  女   电子配件     75.59        9 2020-02-23   \n",
       "19   636-48-8204  分店A  城市A  普通顾客  男   电子配件     34.56        5 2020-02-17   \n",
       "20   233-34-0817  分店C  城市C    会员  女   电子配件     98.84        1 2020-02-15   \n",
       "21   300-71-4605  分店C  城市C    会员  男   电子配件     86.04        5 2020-02-25   \n",
       "22   575-67-1508  分店A  城市A  普通顾客  男   电子配件     38.60        1 2020-01-29   \n",
       "23   551-21-3069  分店C  城市C  普通顾客  女   电子配件     23.07        9 2020-02-01   \n",
       "24   831-07-6050  分店A  城市A  普通顾客  男   电子配件     32.71        5 2020-03-19   \n",
       "25   804-38-3935  分店A  城市A    会员  男   电子配件     93.78        3 2020-01-30   \n",
       "26   886-77-9084  分店C  城市C  普通顾客  男   电子配件     71.89        8 2020-02-19   \n",
       "27   603-07-0961  分店C  城市C    会员  男   电子配件     74.79        5 2020-01-10   \n",
       "28   652-49-6720  分店C  城市C    会员  女   电子配件     60.95        1 2020-02-18   \n",
       "29   189-40-5216  分店C  城市C  普通顾客  男   电子配件     96.37        7 2020-01-09   \n",
       "..           ...  ...  ...   ... ..    ...       ...      ...        ...   \n",
       "970  743-88-1662  分店C  城市C  普通顾客  男  运动与旅行     95.49        7 2020-02-22   \n",
       "971  560-30-5617  分店B  城市B  普通顾客  女  运动与旅行     24.77        5 2020-03-24   \n",
       "972  554-53-3790  分店B  城市B  普通顾客  男  运动与旅行     37.02        6 2020-03-22   \n",
       "973  695-51-0018  分店B  城市B  普通顾客  女  运动与旅行     34.84        4 2020-02-10   \n",
       "974  618-34-8551  分店A  城市A  普通顾客  女  运动与旅行     93.18        2 2020-01-16   \n",
       "975  696-90-2548  分店A  城市A  普通顾客  男  运动与旅行     25.84        3 2020-03-10   \n",
       "976  751-69-0068  分店C  城市C  普通顾客  男  运动与旅行     99.24        9 2020-03-19   \n",
       "977  123-35-4896  分店C  城市C  普通顾客  女  运动与旅行     46.66        9 2020-02-17   \n",
       "978  129-29-8530  分店A  城市A    会员  男  运动与旅行     62.62        5 2020-03-10   \n",
       "979  423-57-2993  分店B  城市B  普通顾客  男  运动与旅行     93.39        6 2020-03-27   \n",
       "980  510-79-0415  分店B  城市B    会员  女  运动与旅行     23.08        6 2020-01-24   \n",
       "981  154-74-7179  分店B  城市B  普通顾客  男  运动与旅行     54.45        1 2020-02-26   \n",
       "982  575-30-8091  分店A  城市A  普通顾客  男  运动与旅行     72.50        8 2020-03-16   \n",
       "983  825-94-5922  分店B  城市B  普通顾客  男  运动与旅行     25.31        2 2020-03-02   \n",
       "984  752-23-3760  分店B  城市B    会员  女  运动与旅行     64.08        7 2020-02-19   \n",
       "985  394-30-3170  分店B  城市B    会员  女  运动与旅行     88.43        8 2020-03-22   \n",
       "986  827-77-7633  分店A  城市A  普通顾客  男  运动与旅行     98.09        9 2020-02-17   \n",
       "987  423-80-0988  分店C  城市C  普通顾客  男  运动与旅行     76.40        2 2020-01-30   \n",
       "988  883-17-4236  分店C  城市C  普通顾客  女  运动与旅行     14.39        2 2020-03-02   \n",
       "989  493-65-6248  分店C  城市C    会员  女  运动与旅行     36.98       10 2020-01-01   \n",
       "990  503-07-0930  分店C  城市C    会员  男  运动与旅行     58.39        7 2020-02-23   \n",
       "991  327-40-9673  分店B  城市B    会员  男  运动与旅行     72.60        6 2020-01-13   \n",
       "992  880-46-5796  分店A  城市A    会员  男  运动与旅行     76.92       10 2020-03-17   \n",
       "993  276-54-0879  分店B  城市B  普通顾客  男  运动与旅行     97.74        4 2020-03-12   \n",
       "994  225-32-0908  分店C  城市C  普通顾客  女  运动与旅行     44.86       10 2020-01-26   \n",
       "995  828-61-5674  分店A  城市A    会员  男  运动与旅行     44.02       10 2020-03-20   \n",
       "996  670-71-7306  分店B  城市B  普通顾客  男  运动与旅行     44.63        6 2020-01-02   \n",
       "997  630-74-5166  分店A  城市A  普通顾客  男  运动与旅行     62.13        6 2020-03-22   \n",
       "998  182-52-7000  分店A  城市A    会员  女  运动与旅行     27.04        4 2020-01-01   \n",
       "999  802-70-5316  分店A  城市A    会员  女  运动与旅行     92.13        6 2020-03-06   \n",
       "\n",
       "           时间  支付方式  支付费用（美元）    收益（美元）  购物体验评分  \n",
       "0    10:02:00    现金    429.87   21.4935     9.8  \n",
       "1    10:17:00   信用卡    142.25    7.1125     9.1  \n",
       "2    10:17:00  电子钱包     96.80    4.8400     8.6  \n",
       "3    10:18:00   信用卡     28.96    1.4480     6.2  \n",
       "4    10:22:00   信用卡    454.80   22.7400     4.8  \n",
       "5    10:23:00    现金    176.54    8.8270     8.2  \n",
       "6    10:23:00   信用卡     99.69    4.9845     8.0  \n",
       "7    10:23:00   信用卡    133.26    6.6630     8.6  \n",
       "8    10:25:00  电子钱包    234.75   11.7375     7.1  \n",
       "9    10:28:00    现金    396.36   19.8180     7.3  \n",
       "10   10:29:00    现金     76.40    3.8200     9.6  \n",
       "11   10:34:00   信用卡    137.13    6.8565     7.7  \n",
       "12   10:38:00  电子钱包    531.16   16.5580     8.9  \n",
       "13   10:40:00  电子钱包     79.44    3.9720     4.7  \n",
       "14   10:46:00   信用卡     66.35    3.3175     9.7  \n",
       "15   10:52:00    现金    544.20   27.2100     5.3  \n",
       "16   10:57:00    现金    388.96   19.4480     5.0  \n",
       "17   11:10:00  电子钱包     55.12    2.7560     9.0  \n",
       "18   11:12:00    现金    680.31   14.0155     8.0  \n",
       "19   11:15:00  电子钱包    172.80    8.6400     9.9  \n",
       "20   11:21:00    现金     98.84    4.9420     8.4  \n",
       "21   11:24:00  电子钱包    430.20   21.5100     4.8  \n",
       "22   11:26:00  电子钱包     38.60    1.9300     6.7  \n",
       "23   11:27:00    现金    207.63   10.3815     4.9  \n",
       "24   11:30:00   信用卡    163.55    8.1775     9.9  \n",
       "25   11:32:00   信用卡    281.34   14.0670     5.9  \n",
       "26   11:33:00  电子钱包    575.12   18.7560     5.5  \n",
       "27   11:34:00    现金    373.95   18.6975     4.9  \n",
       "28   11:40:00  电子钱包     60.95    3.0475     5.9  \n",
       "29   11:40:00    现金    674.59   23.7295     6.0  \n",
       "..        ...   ...       ...       ...     ...  \n",
       "970  18:17:00  电子钱包    668.43   33.4215     8.7  \n",
       "971  18:27:00    现金    123.85    6.1925     8.5  \n",
       "972  18:33:00    现金    222.12   11.1060     4.5  \n",
       "973  18:36:00    现金    139.36    6.9680     7.4  \n",
       "974  18:41:00   信用卡    186.36    9.3180     8.5  \n",
       "975  18:55:00  电子钱包     77.52    3.8760     6.6  \n",
       "976  19:09:00  电子钱包    893.16   44.6580     9.0  \n",
       "977  19:11:00  电子钱包    419.94   20.9970     5.3  \n",
       "978  19:15:00  电子钱包    313.10   15.6550     7.0  \n",
       "979  19:18:00  电子钱包    560.34   28.0170    10.0  \n",
       "980  19:20:00  电子钱包    138.48    6.9240     4.9  \n",
       "981  19:24:00  电子钱包     54.45    2.7225     7.9  \n",
       "982  19:25:00  电子钱包    580.00   29.0000     9.2  \n",
       "983  19:26:00  电子钱包     50.62    2.5310     7.2  \n",
       "984  19:29:00   信用卡    448.56   22.4280     7.3  \n",
       "985  19:35:00   信用卡    707.44   35.3720     4.3  \n",
       "986  19:41:00    现金    882.81  144.1405     9.3  \n",
       "987  19:42:00  电子钱包    152.80    7.6400     6.5  \n",
       "988  19:44:00   信用卡     28.78    1.4390     7.2  \n",
       "989  19:48:00   信用卡    369.80   18.4900     7.0  \n",
       "990  19:49:00   信用卡    408.73   20.4365     8.2  \n",
       "991  19:51:00    现金    435.60   21.7800     6.9  \n",
       "992  19:53:00  电子钱包    769.20   38.4600     5.6  \n",
       "993  19:53:00  电子钱包    390.96  119.5480     6.4  \n",
       "994  19:54:00  电子钱包    448.60   22.4300     8.2  \n",
       "995  19:57:00   信用卡    440.20  122.0100     9.6  \n",
       "996  20:08:00   信用卡    267.78   13.3890     5.1  \n",
       "997  20:19:00    现金    372.78   18.6390     7.4  \n",
       "998  20:26:00  电子钱包    108.16    5.4080     6.9  \n",
       "999  20:34:00    现金    552.78  127.6390     8.3  \n",
       "\n",
       "[1000 rows x 14 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "data_sale = pd.read_excel(\n",
    "            r'F:/python数据分析/chenyun/pandas库/dataset/超市销售数据.xlsx',  #绝对路径。\n",
    ")\n",
    "data_sale"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 案例一： 统计不同性别的顾客中顾客类型的分布差异（统计每组的人数）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>顾客类型</th>\n",
       "      <th>会员</th>\n",
       "      <th>普通顾客</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>性别</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>女</th>\n",
       "      <td>261</td>\n",
       "      <td>240</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>男</th>\n",
       "      <td>240</td>\n",
       "      <td>259</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "顾客类型   会员  普通顾客\n",
       "性别             \n",
       "女     261   240\n",
       "男     240   259"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(\n",
    "    data = data_sale,\n",
    "    values = '发票编号',          #聚合函数：当聚合函数是count（计数）时，聚合变量是随意的\n",
    "    index = '性别',               #行分组变量\n",
    "    columns = '顾客类型',        #列分组变量\n",
    "    aggfunc = 'count',         #聚合函数\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 案例二：统计不同性别不同类型顾客的平均支付费用和人数（有两个聚合函数）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">count</th>\n",
       "      <th colspan=\"2\" halign=\"left\">mean</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>顾客类型</th>\n",
       "      <th>会员</th>\n",
       "      <th>普通顾客</th>\n",
       "      <th>会员</th>\n",
       "      <th>普通顾客</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>性别</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>女</th>\n",
       "      <td>261</td>\n",
       "      <td>240</td>\n",
       "      <td>321.645479</td>\n",
       "      <td>316.412625</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>男</th>\n",
       "      <td>240</td>\n",
       "      <td>259</td>\n",
       "      <td>301.890875</td>\n",
       "      <td>290.521506</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     count             mean            \n",
       "顾客类型    会员 普通顾客          会员        普通顾客\n",
       "性别                                     \n",
       "女      261  240  321.645479  316.412625\n",
       "男      240  259  301.890875  290.521506"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(\n",
    "    data = data_sale,\n",
    "    values = '支付费用（美元）',          #聚合函数：当聚合函数是count（计数）时，聚合变量是随意的\n",
    "    index = '性别',               #行分组变量\n",
    "    columns = '顾客类型',        #列分组变量\n",
    "    aggfunc = ['count','mean']        #聚合函数\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 给表格对象的格子上色"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style  type=\"text/css\" >\n",
       "    #T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row0_col0 {\n",
       "            background-color:  #008000;\n",
       "        }    #T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row0_col1 {\n",
       "            background-color:  #e5ffe5;\n",
       "        }    #T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row0_col2 {\n",
       "            background-color:  #008000;\n",
       "        }    #T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row0_col3 {\n",
       "            background-color:  #008000;\n",
       "        }    #T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row1_col0 {\n",
       "            background-color:  #e5ffe5;\n",
       "        }    #T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row1_col1 {\n",
       "            background-color:  #008000;\n",
       "        }    #T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row1_col2 {\n",
       "            background-color:  #e5ffe5;\n",
       "        }    #T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row1_col3 {\n",
       "            background-color:  #e5ffe5;\n",
       "        }</style>  \n",
       "<table id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5\" > \n",
       "<thead>    <tr> \n",
       "        <th class=\"blank level0\" ></th> \n",
       "        <th class=\"col_heading level0 col0\" colspan=2>count</th> \n",
       "        <th class=\"col_heading level0 col2\" colspan=2>mean</th> \n",
       "    </tr>    <tr> \n",
       "        <th class=\"index_name level1\" >顾客类型</th> \n",
       "        <th class=\"col_heading level1 col0\" >会员</th> \n",
       "        <th class=\"col_heading level1 col1\" >普通顾客</th> \n",
       "        <th class=\"col_heading level1 col2\" >会员</th> \n",
       "        <th class=\"col_heading level1 col3\" >普通顾客</th> \n",
       "    </tr>    <tr> \n",
       "        <th class=\"index_name level0\" >性别</th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "        <th class=\"blank\" ></th> \n",
       "    </tr></thead> \n",
       "<tbody>    <tr> \n",
       "        <th id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5level0_row0\" class=\"row_heading level0 row0\" >女</th> \n",
       "        <td id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row0_col0\" class=\"data row0 col0\" >261</td> \n",
       "        <td id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row0_col1\" class=\"data row0 col1\" >240</td> \n",
       "        <td id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row0_col2\" class=\"data row0 col2\" >321.645</td> \n",
       "        <td id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row0_col3\" class=\"data row0 col3\" >316.413</td> \n",
       "    </tr>    <tr> \n",
       "        <th id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5level0_row1\" class=\"row_heading level0 row1\" >男</th> \n",
       "        <td id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row1_col0\" class=\"data row1 col0\" >240</td> \n",
       "        <td id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row1_col1\" class=\"data row1 col1\" >259</td> \n",
       "        <td id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row1_col2\" class=\"data row1 col2\" >301.891</td> \n",
       "        <td id=\"T_6c2c99dc_d02e_11ec_9398_1c1b0d2b52e5row1_col3\" class=\"data row1 col3\" >290.522</td> \n",
       "    </tr></tbody> \n",
       "</table> "
      ],
      "text/plain": [
       "<pandas.io.formats.style.Styler at 0x83e1080>"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import seaborn as sns\n",
    "result = pd.pivot_table(\n",
    "    data = data_sale,\n",
    "    values = '支付费用（美元）',          #聚合函数：当聚合函数是count（计数）时，聚合变量是随意的\n",
    "    index = '性别',               #行分组变量\n",
    "    columns = '顾客类型',        #列分组变量\n",
    "    aggfunc = ['count','mean']        #聚合函数\n",
    ")\n",
    "colormap = sns.light_palette('green',as_cmap=True)\n",
    "result.style.background_gradient(cmap=colormap)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 根据城市和支付方式进行交叉分析，统计各组人群的总收益（美元），输出结果。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>支付方式</th>\n",
       "      <th>信用卡</th>\n",
       "      <th>现金</th>\n",
       "      <th>电子钱包</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>城市</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>城市A</th>\n",
       "      <td>2335.9405</td>\n",
       "      <td>2998.6310</td>\n",
       "      <td>3362.589</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>城市B</th>\n",
       "      <td>3178.3265</td>\n",
       "      <td>2562.8315</td>\n",
       "      <td>3077.874</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>城市C</th>\n",
       "      <td>2494.1650</td>\n",
       "      <td>3471.7075</td>\n",
       "      <td>2761.304</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "支付方式        信用卡         现金      电子钱包\n",
       "城市                                  \n",
       "城市A   2335.9405  2998.6310  3362.589\n",
       "城市B   3178.3265  2562.8315  3077.874\n",
       "城市C   2494.1650  3471.7075  2761.304"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(\n",
    "    data = data_sale,\n",
    "    values = '收益（美元）',          #聚合函数：当聚合函数是count（计数）时，聚合变量是随意的\n",
    "    index = '城市',               #行分组变量\n",
    "    columns = '支付方式',        #列分组变量\n",
    "    aggfunc = 'sum'       #聚合函数\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
